package com.whmskj.xjlhsc.mapper;

import org.apache.ibatis.annotations.Param;
import java.util.List;

/**
 * 能耗看板数据访问接口
 * 
 * @author lk
 * @since 2025-08-14
 */
public interface EnergyKbMapper {
    /**
     * 统计指定日期范围内，按天汇总的早班与晚班能耗。
     * 数据来源表：shachang_sb_Energy_dissipation_shift
     * 字段：day, shift(早班/夜班等), energy
     */
    List<java.util.Map<String, Object>> selectShiftEnergyBetween(
            @Param("start") java.time.LocalDateTime start,
            @Param("end") java.time.LocalDateTime end);

    /**
     * 区间内各工序能耗（依据 scny02Dictionaries.formId = shachang_sb_Energy_dissipation_day.dbid）
     */
    List<java.util.Map<String, Object>> selectProcessEnergyBetween(
            @Param("start") java.time.LocalDateTime start,
            @Param("end") java.time.LocalDateTime end);

    /**
     * 区间内按天、按车间(workshop)汇总能耗
     */
    List<java.util.Map<String, Object>> selectWorkshopEnergyDailyBetween(
            @Param("start") java.time.LocalDateTime start,
            @Param("end") java.time.LocalDateTime end);

    /**
     * 区间内按周（周一为起始）按车间聚合能耗，返回 periodKey=周一日期
     */
    List<java.util.Map<String, Object>> selectWorkshopEnergyWeeklyBetween(
            @Param("start") java.time.LocalDateTime start,
            @Param("end") java.time.LocalDateTime end);


    /**
     * 区间内按“盘存月”(20日至次月21日)按车间聚合能耗，periodKey=盘存月起始日期YYYY-MM-20
     */
    List<java.util.Map<String, Object>> selectWorkshopEnergyInventoryMonthlyBetween(
            @Param("start") java.time.LocalDateTime start,
            @Param("end") java.time.LocalDateTime end);
}